package com.candy.control;

import com.candy.service.UserInfoService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/updateUserinfo")
public class UpdateUserInfoServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        接收用户输入的参数
        String username=req.getParameter("username");
        String userpwd=req.getParameter("userpwd");
        String useraddress=req.getParameter("useraddress");
        String usertel=req.getParameter("usertel");
        int userid=Integer.parseInt(req.getParameter("id"));
//        调用业务逻辑处理层
        UserInfoService service=new UserInfoService();
        service.updateUserInfo(username,userpwd,useraddress,usertel,userid);
//        调用查询操作刷新页面
        req.getRequestDispatcher("/getUserifoes").forward(req,resp);
    }
}
